package model

import (
	"manager/model/entity"
)

// AlarmCreateRequest 创建现场数据
type AlarmCreateRequest struct {
	UserId int64 `json:"user_id"`

	Type int64 `json:"type"`

	EbikeId int64 `json:"ebike_id"`

	EbikeTypeId int64 `json:"ebike_type_id"`

	EbikeTypeName string `json:"ebike_type_name"`

	Level int `json:"level"`

	UpdatedAt int64 `json:"updated_at"`
}

// AlarmUpdateRequest 更新现场数据
type AlarmUpdateRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	Type *int64 `json:"type"`

	EbikeId *int64 `json:"ebike_id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Level *int `json:"level"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// AlarmListRequest 列表现场数据
type AlarmListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	Type *int64 `json:"type"`

	FrameCode *string `json:"frame_code"`

	EbikeId *int64 `json:"ebike_id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Level *int `json:"level"`

	UpdatedAt *int64 `json:"updated_at"`

	TimeZone []int64 `json:"time_zone"`
}

// AlarmListResponse 列表回包数据
type AlarmListResponse struct {
	Total int          `json:"total"`
	List  []*AlarmInfo `json:"list"`
}

// AlarmInfoRequest 列表现场数据
type AlarmInfoRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	Type *int64 `json:"type"`

	EbikeId *int64 `json:"ebike_id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Level *int `json:"level"`

	UpdatedAt *int64 `json:"updated_at"`
}

// AlarmInfo 详细数据
type AlarmInfo struct {
	Id int64 `json:"id"`

	UserId int64 `json:"user_id"`

	Type int64 `json:"type"`

	EbikeId int64 `json:"ebike_id"`

	EbikeTypeId int64 `json:"ebike_type_id"`

	EbikeTypeName string `json:"ebike_type_name"`

	FrameCode string `json:"frame_code"`

	ControlId int64 `json:"control_id"`

	Level int `json:"level"`

	Score int `json:"score"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// AlarmDeleteRequest 删除现场数据
type AlarmDeleteRequest struct {
	Id int64 `json:"id"`
}

// AlarmsEntityToDto entity数据转换
func AlarmsEntityToDto(alarms []*entity.Alarm) []*AlarmInfo {
	out := make([]*AlarmInfo, 0, len(alarms))
	for _, c := range alarms {
		out = append(out, AlarmEntityToDto(c))
	}
	return out
}

// AlarmEntityToDto entity数据转换
func AlarmEntityToDto(e *entity.Alarm) *AlarmInfo {
	return &AlarmInfo{

		Id: e.Id,

		UserId: e.UserId,

		Type: e.Type,

		EbikeId: e.EbikeId,

		EbikeTypeId: e.EbikeTypeId,

		EbikeTypeName: e.EbikeTypeName,

		FrameCode: e.FrameCode,

		ControlId: e.ControlId,

		Level: e.Level,

		Score: e.Score,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
